﻿Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Data

Public Class project

#Region "Properties"

    Private _projectId As Integer
    Public Property ProjectId() As Integer
        Get
            Return _projectId
        End Get
        Set(ByVal value As Integer)
            _projectId = value
        End Set
    End Property

    Private _name As String
    Public Property Name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property

    Private _description As String
    Public Property Description() As String
        Get
            Return _description
        End Get
        Set(ByVal value As String)
            _description = value
        End Set
	End Property


	Private _ScrumMasterId As String
	Public Property ScrumMasterId() As String
		Get
			Return _ScrumMasterId
		End Get
		Set(ByVal value As String)
			_ScrumMasterId = value
		End Set
	End Property

	Private _ProjectOwnerId As String
	Public Property ProjectOwnerId() As String
		Get
			Return _ProjectOwnerId
		End Get
		Set(ByVal value As String)
			_ProjectOwnerId = value
		End Set
	End Property

#End Region

#Region "Constructors"

    Dim _dal As New ScrumrData

    Sub New()

    End Sub

    Sub New(ByRef iProjectId As Integer)
        Me.GetProjectDetails(iProjectId)
    End Sub

    Public Sub GetProjectDetails(ByRef iProjectId As Integer)
        Me.ProjectId = iProjectId
    End Sub

    Public Sub AddProject(ByVal sProjectName As String, ByVal sProjectDesc As String, ByVal sScrumMasterId As String, ByVal sProjectOwnerId As String)

        Me.Name = sProjectName
        Me.Description = sProjectDesc
        Me.ScrumMasterId = sScrumMasterId
        Me.ProjectOwnerId = sProjectOwnerId

        Try
            Me.ProjectId = _dal.SaveProject(Me.Name, Me.Description, Me.ScrumMasterId, Me.ProjectOwnerId)
        Catch ex As Exception
            Throw New Exception("Business layer error: " & ex.Message)
        End Try


    End Sub
#End Region
End Class
